#include "client.h"
#include <string.h>
#include "datatype.h"

#define CLIENT_NAME "lxy"

int login(client &myClient)
{

	char name[MESSAGE_NAME_SIZE];
	char password[MESSAGE_NAME_SIZE];

	cout << "please input your name" << endl;
	cin >> name;
	getchar();
	
	cout << "please input your passowrd" << endl;
	cin >> password;
	getchar();

	cout << "name set successful" << endl;
	
	myClient.setUser(name,password);
}
int regist()
{

}
int main(int argc, const char *argv[])
{

	client myClient(SERVER_IP,SERVER_PORT);

	if((argc == 2) && (strcmp(argv[1],"regist") == 0))
	{
		cout << "ready to regist a user" << endl;	
		myClient.setMode(MSG_TYPE_REGIST);
	}
	else
	{
		cout << "ready to login a user" << endl;
		myClient.setMode(MSG_TYPE_LOGIN);
	}

	login(myClient);
	myClient.start();
	return 0;
}
